/*
 * PBBTimer.java
 *
 * Created on May 22, 2007, 10:41 AM
 *
 * This class is an extension o the PBB thread.  It is used to 'schedule' updates to the wiki
 * server.  Since a maximum of 10 updates per minute is allowed, we can extrapolate that as
 * 1 update per 6 seconds.  We'll make it a tad more kind than that and only update every 6.5 seconds.
 * This thread should activate no more than once per 6.5 seconds, but could take longer.
 *
 *Copyright 2007-2008 Jon W Huss III

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 *
 */

package proteinboxbot;


import java.io.*;
import java.util.*;
import java.security.*;
import java.util.zip.*;

//Window Imports
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import proteinboxbot.*;

/**
 *
 * @author Jon Huss
 */
public class PBBTimer extends PBBThread {
    
    public static final int UPDATE_TIME = 6500;
    
    /** Creates a new instance of PBBTimer */
    public PBBTimer() {
        
    }
    
    public void pbbThreadRun() {
        //Standard thread operation.
        while(!killMe) {
        //Debugging
        System.out.println("Post!");
        
         //sleep the thread (yield)
            try{
                Thread.currentThread().sleep(UPDATE_TIME);
            } catch (Exception e){
                e.printStackTrace();
            }
        }
        
        System.out.println("Got kill Signal. Terminating Timer.");
        //rejoin this thread.
        try{
            this.join();
            
        } catch (Exception e){
            e.printStackTrace();
        }
        
    }
    
}
